{% import "system/macro/row/checkbox-list.html.twig" as row_checkbox_list %}

{% if isLicenseExpired() %}
    {% if withOverwriteConfigurationOption %}
        {% embed "system/embed/form-row.html.twig" %}
            {% import "system/macro/form-component/info-hint.html.twig" as hint %}

            {% block label %}
                {% set synchronizeConfigurationHintText = localized.hint.synchronizeConfigurationRepositoryEntry %}

                {% if isCreateAction == true and hasRepository == true %}
                    {% set synchronizeConfigurationHintText = localized.hint.languages %}
                {% elseif hasRepository == false %}
                    {% set synchronizeConfigurationHintText = localized.hint.synchronizeConfiguration %}
                {% endif %}

                <div id="{{ generateFormFieldId('configuration', collectionName) }}-parent" class="bc-flex bc-items-center">
                    <span>{{ isCreateAction == true and hasRepository == true ? localized.field.languages : localized.field.synchronizeConfiguration | raw }}</span>
                    <div class="bc-inline-block bc-pl-1">
                        {{ hint.component({
                            hint: synchronizeConfigurationHintText
                        }) }}
                    </div>
                </div>
            {% endblock %}

            {% block input %}
                {{ getLicenseAlertMessage('licenseExpiredFeatureNotAvailable') | raw }}
            {% endblock %}
        {% endembed %}
    {% endif %}

    {% if withOverwriteTranslationOption and isCreateAction == false %}
        {% embed "system/embed/form-row.html.twig" %}
            {% import "system/macro/form-component/info-hint.html.twig" as hint %}

            {% block label %}
                {% set synchronizeTranslationHintText = localized.hint.synchronizeTranslationRepositoryEntry %}

                {% if hasRepository == false %}
                    {% set synchronizeTranslationHintText = localized.hint.synchronizeTranslation %}
                {% endif %}

                <div id="{{ generateFormFieldId('translation', collectionName) }}-parent" class="bc-flex bc-items-center">
                    <span>{{ localized.field.synchronizeTranslation | raw }}</span>
                    <div class="bc-inline-block bc-pl-1">
                        {{ hint.component({
                            hint: synchronizeTranslationHintText
                        }) }}
                    </div>
                </div>
            {% endblock %}

            {% block input %}
                {{ getLicenseAlertMessage('licenseExpiredFeatureNotAvailable') | raw }}
            {% endblock %}
        {% endembed %}
    {% endif %}
{% else %}
    {% if withOverwriteConfigurationOption and checkboxes|length %}
        {% set synchronizeConfigurationHintText = localized.hint.synchronizeConfigurationRepositoryEntry %}

        {% if isCreateAction == true and hasRepository == true %}
            {% set synchronizeConfigurationHintText = localized.hint.languages %}
        {% elseif hasRepository == false %}
            {% set synchronizeConfigurationHintText = localized.hint.synchronizeConfiguration %}
        {% endif %}

        {{ row_checkbox_list.component({
            checkboxes: checkboxes,
            checkedKeys: isCreateAction == true and hasRepository == true  ? checkedKeys : [],
            hint: synchronizeConfigurationHintText,
            id: generateFormFieldId('configuration', collectionName),
            name: generateFormFieldName('configuration', collectionName),
            title: isCreateAction == true and hasRepository == true ? localized.field.languages : localized.field.synchronizeConfiguration,
        }) }}
    {% endif %}

    {% if withOverwriteTranslationOption and checkboxes|length %}
        {% if isCreateAction == false %}
            {% set synchronizeTranslationHintText = localized.hint.synchronizeTranslationRepositoryEntry %}

            {% if hasRepository == false %}
                {% set synchronizeTranslationHintText = localized.hint.synchronizeTranslation %}
            {% endif %}

            {{ row_checkbox_list.component({
                checkboxes: checkboxes,
                checkedKeys: [],
                hint: synchronizeTranslationHintText,
                id: generateFormFieldId('translation', collectionName),
                name: generateFormFieldName('translation', collectionName),
                title: localized.field.synchronizeTranslation,
            }) }}
        {% endif %}
    {% endif %}
{% endif %}
